package grooverse.util

class QualifiedBuilderDelegator {

    private QualifiedBuilderSupport builder;
    private String method;

    QualifiedBuilderDelegator(QualifiedBuilderSupport builder, String method) {
        this.builder = builder
        this.method = method
    }

    Object getAt(Object key) {
        builder.@qualifier = key
        return { Object[] args ->
            this.@builder."${this.@method}"(*args)
        }
    }

    Object getProperty(String name) {
        getAt(name)
    }

}